package org.thunms.framework.core;

import org.hibernate.cfg.ImprovedNamingStrategy;
import org.hibernate.cfg.NamingStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
 *说明:  .
 *<P>注释要求： 1.方法或类的作用;2.采用算法说明;3.特殊调用说明;4.复杂逻辑说明;5.Action需说明返回值后页面转向;6.清理掉用不上的参数及文档标记</p> 
 * @author wanglp 2012-7-11 下午3:31:00
 */
public class EntityNamingStrategy extends ImprovedNamingStrategy implements NamingStrategy {
	private static final long serialVersionUID = -3806597040841453197L;
	private static final Logger logger=LoggerFactory.getLogger(EntityNamingStrategy.class);

	@Override
	public String classToTableName(String className) {
		logger.debug("--------------className----------------->>>>"+className);
		return "t_"+ super.classToTableName(className).replace("_entity", "");
	}

	@Override
	public String collectionTableName(String ownerEntity, String ownerEntityTable, String associatedEntity,
			String associatedEntityTable, String propertyName) {
		logger.debug("--------------ownerEntity----------------->>>>"+ownerEntity);
		logger.debug("--------------ownerEntityTable----------------->>>>"+ownerEntityTable);
		logger.debug("--------------associatedEntity----------------->>>>"+associatedEntity);
		logger.debug("--------------associatedEntityTable----------------->>>>"+associatedEntityTable);
		logger.debug("--------------propertyName----------------->>>>"+propertyName);
		
		return super.collectionTableName(ownerEntity, ownerEntityTable, associatedEntity, associatedEntityTable, propertyName);
	}
	
	

}
